import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 支付记录信息 */
export interface BrokeragePayRecord {
          id: number; // 主键(自增策略)
          openid?: string; // 微信公众号openid
          userId?: number; // 用户编号
          tableName?: string; // 数据来源
          payAmount?: number; // 支付金额
          payStatus?: boolean; // 订单状态：0-正常 1-退款
          brokerageStatus?: boolean; // 分佣状态：0-未分佣 1-已分佣
          brokerageUserId: number; // 结算用户ID
          brokerageAmount: number; // 佣金
          brokerageId: number; // 佣金记录ID
          tableId?: number; // 数据来源ID
  }

// 支付记录 API
export const BrokeragePayRecordApi = {
  // 查询支付记录分页
  getBrokeragePayRecordPage: async (params: any) => {
    return await request.get({ url: `/system/brokerage-pay-record/page`, params })
  },

  // 查询支付记录详情
  getBrokeragePayRecord: async (id: number) => {
    return await request.get({ url: `/system/brokerage-pay-record/get?id=` + id })
  },

  // 新增支付记录
  createBrokeragePayRecord: async (data: BrokeragePayRecord) => {
    return await request.post({ url: `/system/brokerage-pay-record/create`, data })
  },

  // 修改支付记录
  updateBrokeragePayRecord: async (data: BrokeragePayRecord) => {
    return await request.put({ url: `/system/brokerage-pay-record/update`, data })
  },

  // 删除支付记录
  deleteBrokeragePayRecord: async (id: number) => {
    return await request.delete({ url: `/system/brokerage-pay-record/delete?id=` + id })
  },

  /** 批量删除支付记录 */
  deleteBrokeragePayRecordList: async (ids: number[]) => {
    return await request.delete({ url: `/system/brokerage-pay-record/delete-list?ids=${ids.join(',')}` })
  },

  // 导出支付记录 Excel
  exportBrokeragePayRecord: async (params) => {
    return await request.download({ url: `/system/brokerage-pay-record/export-excel`, params })
  }
}